

import { count, log } from "console";
import React, { Component } from "react";
import type { ReactNode } from 'react'


interface iState {

}
export default class App extends Component {

    state = {
        count: 100
    }

    btnClick1(val: string) {
        console.log('btn1', val);
        this.setState({
            count: this.state.count + 1
        })
    }
    btnClick2 = (val: string) => {
        console.log('btn2', val);
        this.setState({
            count: this.state.count + 2
        })
    }

    btnClick3(val: string) {
        console.log(this, val);

    }

    render() {

        return <>
            <div>
                <h1>父组件 --- {this.state.count}</h1>
                {/* 
                    1. 事件
                    2. 表单
                    3. 生命周期
                    4. axios
                 */}


                <button onClick={() => {
                    this.btnClick1('哈哈哈')
                }}>点击传参1</button>

                <button onClick={() => {
                    this.btnClick2('hhhhh')
                }}>点击传参2</button>


                {/* .bind 是用来修改 this 执行的方法 */}
                <button onClick={this.btnClick3.bind(this, '参数嘿嘿嘿')}>点击传参3</button>

            </div>
        </>
    }

}